<?php if (!defined("_ECRIRE_INC_VERSION")) return; if (class_exists('PdkCategoryModel')) return;
/**
 * SPIP Plugin Development Kit
 *
 * @author     Aleksey Yaroshchuk (aleksey.yaroshchuk@gmail.com)
 * @license    GNU/GPL
 * @package    plugins
 * @subpackage pdk
 * @category   outils
 * @copyright  (c) Aleksey Yaroshchuk 2011-2012
 * @link       http://www.spip-contrib.net/Developmet-Kit
 * @version    1.0.0
 */

include_spip('classes/pdk_model');
/**
 *  Pdk Category Class
 * 
 * 	This is an example class wich shows how to use pdk_Model class 
 *
 * @package		plugins
 * @subpackage	pdk
 * @category	outils
 * @author		Aleksey Yaroshchuk (aleksey.yaroshchuk@gmail.com)
 * @link		http://www.spip-contrib.net/Developmet-Kit
 */
class PdkCategoryModel extends pdk_Model {
    public function __construct() {
        parent::__construct();
        $this->config_model();        
    }
    
    function config_model() {
        // Define main table:
        $this->main_table = 'spip_pdk_categories';
        
        // Define primary key:
        $this->primary_key = 'id_category';
        
        // Define main table fields:
        $this->main_fields['id_category'] = 'id_category'; 
        $this->main_fields['titre'] = 'titre';
        $this->main_fields['description'] = 'description';
    }
    
    // Define some test data
    public $test_data = array(
        array('id_category'=>1,'titre'=>'Test category 1', 'description'=>'Category description 1'),
        array('id_category'=>2,'titre'=>'Test category 2', 'description'=>'Category description 2'),
        array('id_category'=>3,'titre'=>'Test category 3', 'description'=>'Category description 3'),
        array('id_category'=>4,'titre'=>'Test category 4', 'description'=>'Category description 4')
    );
}
?>